home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume7 / xmeter / patch2 < prev    next >
Encoding:
Internet Message Format  |  1990-06-08  |  18.8 KB

  1. Path: uunet!cs.utexas.edu!texbell!texsun!newstop!sun!rand.org
  2. From: bobs%moose@rand.org (Robert Schwartzkopf)
  3. Newsgroups: comp.sources.x
  4. Subject: v07i087: xmeter - Display rstat statistics, Patch2, Part01/01
  5. Message-ID: <136909@sun.Eng.Sun.COM>
  6. Date: 8 Jun 90 17:39:21 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 704
  9. Approved: argv@sun.com
  10.  
  11. Submitted-by: Robert Schwartzkopf <bobs%moose@rand.org>
  12. Posting-number: Volume 7, Issue 87
  13. Archive-name: xmeter/patch2
  14. Patch-To: xmeter: Volume 6, Issue 98
  15. Patch-To: xmeter: Volume 7, Issue 34 (patch 1)
  16.  
  17. This patch includes many bug fixes suggested by various people.
  18. My thanks to everyone who took the time to find the bugs and report them.
  19.  
  20. Bob Schwartzkopf (bobs@rand.org)
  21.  
  22. #    This is a shell archive.
  23. #    Remove everything above and including the cut line.
  24. #    Then run the rest of the file through sh.
  25. #----cut here-----cut here-----cut here-----cut here----#
  26. #!/bin/sh
  27. # shar:    Shell Archiver
  28. #    Run the following text with /bin/sh to create:
  29. #    patch2
  30. # This archive created: Thu Jun  7 16:33:40 1990
  31. echo shar: extracting patch2
  32. sed 's/^XX//' << \SHAR_EOF > patch2
  33. XX*** /tmp/,RCSt1a14009    Thu Jun  7 16:32:02 1990
  34. XX--- patchlevel.h    Thu Jun  7 16:25:06 1990
  35. XX***************
  36. XX*** 1 ****
  37. XX! #define PATCHLEVEL 1
  38. XX--- 1 ----
  39. XX! #define PATCHLEVEL 2
  40. XX*** /tmp/,RCSt1a14045    Thu Jun  7 16:32:37 1990
  41. XX--- xmeter.c    Thu Jun  7 16:23:26 1990
  42. XX***************
  43. XX*** 5,19 ****
  44. XX   *
  45. XX   * Suggestions for improvements and bug fixes can be sent to "bobs@rand.org".
  46. XX   * As my schedule permits I'll try to incorporate them.  xmeter is known
  47. XX!  * to run under X11 R4 on sun3s and sun4s running SunOS 4.0.3.
  48. XX   */
  49. XX  
  50. XX  #ifndef lint
  51. XX! static char    *RCSid="$Header:
  52. /tmp_mnt/home/src/rand/xmeter/RCS/xmeter.c,v 1.2 90/05/04 12:31:52 bobs Exp $";
  53. XX  #endif lint
  54. XX  
  55. XX  /*
  56. XX   * $Log:    xmeter.c,v $
  57. XX   * Revision 1.2  90/05/04  12:31:52  bobs
  58. XX   * Fix memory leak in getport().  Wasn't freeing resources allocated by
  59. XX   * clntudp_create when clnt_call failed.  Also removed explicit calls
  60. XX--- 5,30 ----
  61. XX   *
  62. XX   * Suggestions for improvements and bug fixes can be sent to "bobs@rand.org".
  63. XX   * As my schedule permits I'll try to incorporate them.  xmeter is known
  64. XX!  * to run under X11 R4 on sun3s and sun4s running SunOS 4.0.3, 4.1.
  65. XX   */
  66. XX  
  67. XX  #ifndef lint
  68. XX! static char    *RCSid="$Header:
  69. /tmp_mnt/home/src/rand/xmeter/RCS/xmeter.c,v 1.3 90/06/07 16:17:06 bobs Exp $";
  70. XX  #endif lint
  71. XX  
  72. XX  /*
  73. XX   * $Log:    xmeter.c,v $
  74. XX+  * Revision 1.3  90/06/07  16:17:06  bobs
  75. XX+  * Removed "retries".
  76. XX+  * Changed name of paned widgets to host name displayed in that widget.
  77. XX+  * Used actual time between rstat calls instead of "update" interval in
  78. XX+  * computing rates in functions that return values to stripchart widgets.
  79. XX+  * Removed "ost" variable, rewrote functions that return values to
  80. XX+  * stripcharts.
  81. XX+  * Fixed bug in fsys, fcpu and fuser that could cause divide by 0 errors.
  82. XX+  * Fixed rpc timeout handling in getmeter and getport.
  83. XX+  * Use RSTATVERS_TIME instead of RSTATVERS, which isn't defined in SunOS 4.1.
  84. XX+  * 
  85. XX   * Revision 1.2  90/05/04  12:31:52  bobs
  86. XX   * Fix memory leak in getport().  Wasn't freeing resources allocated by
  87. XX   * clntudp_create when clnt_call failed.  Also removed explicit calls
  88. XX***************
  89. XX*** 63,68 ****
  90. XX--- 74,80 ----
  91. XX      int            idx;    /* Index into st array            */
  92. XX      int            refcnt;    /* Meters sharing this structure    */
  93. XX      int            curcnt;    /* Meters who've displayed current data    */
  94. XX+     int            first;    /* TRUE when only 1 rstat has been done    */
  95. XX      struct shmeter    *nxt;    /* Link these together            */
  96. XX  } SHMETER;
  97. XX  
  98. XX***************
  99. XX*** 136,142 ****
  100. XX  int            errorLevel;
  101. XX  XtOrientation        orientation;
  102. XX  int            timeout;
  103. XX- int            retries;
  104. XX  int            update;
  105. XX  short            width;
  106. XX  int            loadscaledef = FSCALE;
  107. XX--- 148,153 ----
  108. XX***************
  109. XX*** 147,154 ****
  110. XX      (Cardinal) &width, XtRString, "80"},
  111. XX      {"timeout", "Timeout", XtRInt, sizeof (int),
  112. XX      (Cardinal) &timeout, XtRString, "5"},
  113. XX-     {"retries", "Retries", XtRInt, sizeof (int),
  114. XX-     (Cardinal) &retries, XtRString, "2"},
  115. XX      {"okBack", "OkBack", XtRPixel, sizeof (Pixel),
  116. XX      (Cardinal) &back[OK], XtRString, "white"},
  117. XX      {"warnBack", "WarnBack", XtRPixel, sizeof (Pixel),
  118. XX--- 158,163 ----
  119. XX***************
  120. XX*** 195,201 ****
  121. XX  static char        *progname;
  122. XX  static XrmOptionDescRec    options[] = {
  123. XX      {"-timeout",    "timeout",        XrmoptionSepArg,    NULL},
  124. XX-     {"-retries",    "retries",        XrmoptionSepArg,    NULL},
  125. XX      {"-orientation",    "orientation",    
  126. XrmoptionSepArg,    NULL},
  127. XX      {"-okBack",        "okBack",    
  128. XrmoptionSepArg,    NULL},
  129. XX      {"-warnBack",    "warnBack",        XrmoptionSepArg,    NULL},
  130. XX--- 204,209 ----
  131. XX***************
  132. XX*** 228,234 ****
  133. XX      {XtNresizable,        TRUE },        /* Resizable        */
  134. XX  };
  135. XX  static struct timeval    ptto = {0, 0};
  136. XX- static struct timeval    tto = {0, 0};
  137. XX  static Arg        args[20];
  138. XX  static SHMETER        *shmeters = NULL;
  139. XX  
  140. XX--- 236,241 ----
  141. XX***************
  142. XX*** 241,247 ****
  143. XX    Widget    toplevel;
  144. XX    Widget    form;
  145. XX    Widget    meter;
  146. XX-   Widget    label;
  147. XX    Widget    pane = NULL;
  148. XX    int        i;
  149. XX    int        n;
  150. XX--- 248,253 ----
  151. XX***************
  152. XX*** 257,263 ****
  153. XX    XtGetApplicationResources (toplevel, NULL, application_resources,
  154. XX                   XtNumber (application_resources), NULL, 0);
  155. XX    ptto.tv_sec = timeout;
  156. XX-   tto.tv_sec = retries * timeout;
  157. XX    form = XtCreateManagedWidget ("form", formWidgetClass, toplevel,
  158. XX                      formargs, XtNumber (formargs));
  159. XX    if (argc < 2)
  160. XX--- 263,268 ----
  161. XX***************
  162. XX*** 271,284 ****
  163. XX        n = 0;
  164. XX        XtSetArg (args[n], orient, pane); n++;
  165. XX        XtSetArg (args[n], XtNwidth, width); n++;
  166. XX!       pane = XtCreateManagedWidget ("paned", panedWidgetClass, form, args, n);
  167. XX        n = 0;
  168. XX        XtSetArg (args[n], XtNshowGrip, XtEno); n++;
  169. XX        XtSetArg (args[n], XtNlabel, h->label); n++;
  170. XX        XtSetArg (args[n], XtNbackground, back[OK]); n++;
  171. XX!       label = XtCreateManagedWidget ("label", labelWidgetClass,
  172. XX!                      pane, args, n);
  173. XX!       h->labelwidget = label;
  174. XX        n = 0;
  175. XX        XtSetArg (args[n], orient, meter); n++;
  176. XX        XtSetArg (args[n], XtNresizable, TRUE); n++;
  177. XX--- 276,289 ----
  178. XX        n = 0;
  179. XX        XtSetArg (args[n], orient, pane); n++;
  180. XX        XtSetArg (args[n], XtNwidth, width); n++;
  181. XX!       pane = XtCreateManagedWidget (h->sh->name, panedWidgetClass,
  182. XX!                     form, args, n);
  183. XX        n = 0;
  184. XX        XtSetArg (args[n], XtNshowGrip, XtEno); n++;
  185. XX        XtSetArg (args[n], XtNlabel, h->label); n++;
  186. XX        XtSetArg (args[n], XtNbackground, back[OK]); n++;
  187. XX!       h->labelwidget = XtCreateManagedWidget ("label", labelWidgetClass,
  188. XX!                           pane, args, n);
  189. XX        n = 0;
  190. XX        XtSetArg (args[n], orient, meter); n++;
  191. XX        XtSetArg (args[n], XtNresizable, TRUE); n++;
  192. XX***************
  193. XX*** 342,353 ****
  194. XX    *(double *) data = s == FATAL ? 0.0 : (double) l / sd[h->stat].scale;
  195. XX    sh = h->sh;
  196. XX    if (s != h->oldstate) {
  197. XX!       n = 0;        /* Change background in pane widget        */
  198. XX        XtSetArg (args[n], XtNbackground, back[s]); n++;
  199. XX        XtSetValues (w, args, n);
  200. XX!       n = 0;        /* Change background in label widget        */
  201. XX        XtSetArg (args[n], XtNbackground, back[s]); n++;
  202. XX!       if (s == FATAL || h->oldstate == FATAL) {    /* Change label too    */
  203. XX        sprintf (h->label, "%s %s", sh->name,
  204. XX             s == FATAL ? DMSG : sd[h->stat].name);
  205. XX        XtSetArg (args[n], XtNlabel, h->label); n++;
  206. XX--- 347,358 ----
  207. XX    *(double *) data = s == FATAL ? 0.0 : (double) l / sd[h->stat].scale;
  208. XX    sh = h->sh;
  209. XX    if (s != h->oldstate) {
  210. XX!       n = 0;        /* Change background in stripchart widget    */
  211. XX        XtSetArg (args[n], XtNbackground, back[s]); n++;
  212. XX        XtSetValues (w, args, n);
  213. XX!       n = 0;        /* Update label widget                */
  214. XX        XtSetArg (args[n], XtNbackground, back[s]); n++;
  215. XX!       if (s == FATAL || h->oldstate == FATAL) {
  216. XX        sprintf (h->label, "%s %s", sh->name,
  217. XX             s == FATAL ? DMSG : sd[h->stat].name);
  218. XX        XtSetArg (args[n], XtNlabel, h->label); n++;
  219. XX***************
  220. XX*** 382,392 ****
  221. XX   * value and the previous value, and dividing by the update interval in
  222. XX   * order to get the current rate.
  223. XX   */
  224. XX  
  225. XX! int fuser (h, ost)
  226. XX  
  227. XX! METER            *h;
  228. XX! struct statstime    *ost;
  229. XX  
  230. XX  {
  231. XX    int    i;
  232. XX--- 387,398 ----
  233. XX   * value and the previous value, and dividing by the update interval in
  234. XX   * order to get the current rate.
  235. XX   */
  236. XX+ #define DIF(m,fld)    (m->sh->st[m->sh->idx].fld - \
  237. XX+              m->sh->st[m->sh->idx ^ 1].fld)
  238. XX  
  239. XX! int fuser (h)
  240. XX  
  241. XX! METER    *h;
  242. XX  
  243. XX  {
  244. XX    int    i;
  245. XX***************
  246. XX*** 393,410 ****
  247. XX    int    t;
  248. XX    int    d[CPUSTATES];
  249. XX  
  250. XX!   if (ost) {
  251. XX!       for (t = 0, i= 0; i < CPUSTATES; i++)
  252. XX!       t += (d[i] = h->sh->st[h->sh->idx].cp_time[i] - ost->cp_time[i]);
  253. XX!       return ((100 * (d[CP_USER] + d[CP_NICE])) / t);
  254. XX!   } else
  255. XX!       return (0);
  256. XX  }
  257. XX  
  258. XX! int fsys (h, ost)
  259. XX  
  260. XX! METER            *h;
  261. XX! struct statstime    *ost;
  262. XX  
  263. XX  {
  264. XX    int    i;
  265. XX--- 399,412 ----
  266. XX    int    t;
  267. XX    int    d[CPUSTATES];
  268. XX  
  269. XX!   for (t = 0, i= 0; i < CPUSTATES; i++)
  270. XX!       t += (d[i] = DIF (h, cp_time[i]));
  271. XX!   return (t ? (100 * (d[CP_USER] + d[CP_NICE])) / t : 0);
  272. XX  }
  273. XX  
  274. XX! int fsys (h)
  275. XX  
  276. XX! METER    *h;
  277. XX  
  278. XX  {
  279. XX    int    i;
  280. XX***************
  281. XX*** 411,428 ****
  282. XX    int    t;
  283. XX    int    d[CPUSTATES];
  284. XX  
  285. XX!   if (ost) {
  286. XX!       for (t = 0, i= 0; i < CPUSTATES; i++)
  287. XX!       t += (d[i] = h->sh->st[h->sh->idx].cp_time[i] - ost->cp_time[i]);
  288. XX!       return ((100 * d[CP_SYS]) / t);
  289. XX!   } else
  290. XX!       return (0);
  291. XX  }
  292. XX  
  293. XX! int fcpu (h, ost)
  294. XX  
  295. XX! METER            *h;
  296. XX! struct statstime    *ost;
  297. XX  
  298. XX  {
  299. XX    int    i;
  300. XX--- 413,426 ----
  301. XX    int    t;
  302. XX    int    d[CPUSTATES];
  303. XX  
  304. XX!   for (t = 0, i= 0; i < CPUSTATES; i++)
  305. XX!       t += (d[i] = DIF (h, cp_time[i]));
  306. XX!   return (t ? (100 * d[CP_SYS]) / t : 0);
  307. XX  }
  308. XX  
  309. XX! int fcpu (h)
  310. XX  
  311. XX! METER    *h;
  312. XX  
  313. XX  {
  314. XX    int    i;
  315. XX***************
  316. XX*** 429,545 ****
  317. XX    int    t;
  318. XX    int    d[CPUSTATES];
  319. XX  
  320. XX!   if (ost) {
  321. XX!       for (t = 0, i= 0; i < CPUSTATES; i++)
  322. XX!       t += (d[i] = h->sh->st[h->sh->idx].cp_time[i] - ost->cp_time[i]);
  323. XX!       return ((100 * (d[CP_USER]+d[CP_NICE]+d[CP_SYS])) / t);
  324. XX!   } else
  325. XX!       return (0);
  326. XX  }
  327. XX  
  328. XX! int fpgpgin (h, ost)
  329. XX  
  330. XX! METER            *h;
  331. XX! struct statstime    *ost;
  332. XX  
  333. XX  {
  334. XX!   return (ost ? (h->sh->st[h->sh->idx].v_pgpgin - ost->v_pgpgin) / update : 0);
  335. XX  }
  336. XX  
  337. XX! int fpgpgout (h, ost)
  338. XX  
  339. XX! METER            *h;
  340. XX! struct statstime    *ost;
  341. XX  
  342. XX  {
  343. XX!   return (ost ? (h->sh->st[h->sh->idx].v_pgpgout - ost->v_pgpgout)
  344. / update : 0);
  345. XX  }
  346. XX  
  347. XX! int  fpswpin (h, ost)
  348. XX  
  349. XX! METER            *h;
  350. XX! struct statstime    *ost;
  351. XX  
  352. XX  {
  353. XX!   return (ost ? (h->sh->st[h->sh->idx].v_pswpin - ost->v_pswpin) / update : 0);
  354. XX  }
  355. XX  
  356. XX! int fpswpout (h, ost)
  357. XX  
  358. XX! METER            *h;
  359. XX! struct statstime    *ost;
  360. XX  
  361. XX  {
  362. XX!   return (ost ? (h->sh->st[h->sh->idx].v_pswpout - ost->v_pswpout)
  363. / update : 0);
  364. XX  }
  365. XX  
  366. XX! int fintr (h, ost)
  367. XX  
  368. XX! METER            *h;
  369. XX! struct statstime    *ost;
  370. XX  
  371. XX  {
  372. XX!   return (ost ? (h->sh->st[h->sh->idx].v_intr - ost->v_intr) / update : 0);
  373. XX  }
  374. XX  
  375. XX! int fipkt (h, ost)
  376. XX  
  377. XX! METER            *h;
  378. XX! struct statstime    *ost;
  379. XX  
  380. XX  {
  381. XX!   return (ost ? (h->sh->st[h->sh->idx].if_ipackets -
  382. ost->if_ipackets) / update : 0);
  383. XX  }
  384. XX  
  385. XX! int fierr (h, ost)
  386. XX  
  387. XX! METER            *h;
  388. XX! struct statstime    *ost;
  389. XX  
  390. XX  {
  391. XX!   return (ost ? (h->sh->st[h->sh->idx].if_ierrors -
  392. ost->if_ierrors) / update : 0);
  393. XX  }
  394. XX  
  395. XX! int fopkt (h, ost)
  396. XX  
  397. XX! METER            *h;
  398. XX! struct statstime    *ost;
  399. XX  
  400. XX  {
  401. XX!   return (ost ? (h->sh->st[h->sh->idx].if_opackets -
  402. ost->if_opackets)/update : 0);
  403. XX  }
  404. XX  
  405. XX! int foerr (h, ost)
  406. XX  
  407. XX! METER            *h;
  408. XX! struct statstime    *ost;
  409. XX  
  410. XX  {
  411. XX!   return (ost ? (h->sh->st[h->sh->idx].if_oerrors -
  412. ost->if_oerrors) / update : 0);
  413. XX  }
  414. XX  
  415. XX! int fcoll (h, ost)
  416. XX  
  417. XX! METER            *h;
  418. XX! struct statstime    *ost;
  419. XX  
  420. XX  {
  421. XX!   return (ost ? (h->sh->st[h->sh->idx].if_collisions -
  422. ost->if_collisions) / update : 0);
  423. XX  }
  424. XX  
  425. XX! int fswt (h, ost)
  426. XX  
  427. XX! METER            *h;
  428. XX! struct statstime    *ost;
  429. XX  
  430. XX  {
  431. XX!   return (ost ? (h->sh->st[h->sh->idx].v_swtch - ost->v_swtch) / update : 0);
  432. XX  }
  433. XX  
  434. XX! int fload (h, ost)
  435. XX  
  436. XX! METER            *h;
  437. XX! struct statstime    *ost;
  438. XX  
  439. XX  {
  440. XX    return (h->sh->st[h->sh->idx].avenrun[0]);
  441. XX--- 427,528 ----
  442. XX    int    t;
  443. XX    int    d[CPUSTATES];
  444. XX  
  445. XX!   for (t = 0, i= 0; i < CPUSTATES; i++)
  446. XX!       t += (d[i] = DIF (h, cp_time[i]));
  447. XX!   return (t ? (100 * (d[CP_USER]+d[CP_NICE]+d[CP_SYS])) / t : 0);
  448. XX  }
  449. XX  
  450. XX! int fpgpgin (h)
  451. XX  
  452. XX! METER    *h;
  453. XX  
  454. XX  {
  455. XX!   return (DIF (h, v_pgpgin) / DIF (h, curtime.tv_sec));
  456. XX  }
  457. XX  
  458. XX! int fpgpgout (h)
  459. XX  
  460. XX! METER    *h;
  461. XX  
  462. XX  {
  463. XX!   return (DIF (h, v_pgpgout) / DIF (h, curtime.tv_sec));
  464. XX  }
  465. XX  
  466. XX! int  fpswpin (h)
  467. XX  
  468. XX! METER    *h;
  469. XX  
  470. XX  {
  471. XX!   return (DIF (h, v_pswpin) / DIF (h, curtime.tv_sec));
  472. XX  }
  473. XX  
  474. XX! int fpswpout (h)
  475. XX  
  476. XX! METER    *h;
  477. XX  
  478. XX  {
  479. XX!   return (DIF (h, v_pswpout) / DIF (h, curtime.tv_sec));
  480. XX  }
  481. XX  
  482. XX! int fintr (h)
  483. XX  
  484. XX! METER    *h;
  485. XX  
  486. XX  {
  487. XX!   return (DIF (h, v_intr) / DIF (h, curtime.tv_sec));
  488. XX  }
  489. XX  
  490. XX! int fipkt (h)
  491. XX  
  492. XX! METER    *h;
  493. XX  
  494. XX  {
  495. XX!   return (DIF (h, if_ipackets) / DIF (h, curtime.tv_sec));
  496. XX  }
  497. XX  
  498. XX! int fierr (h)
  499. XX  
  500. XX! METER    *h;
  501. XX  
  502. XX  {
  503. XX!   return (DIF (h, if_ierrors) / DIF (h, curtime.tv_sec));
  504. XX  }
  505. XX  
  506. XX! int fopkt (h)
  507. XX  
  508. XX! METER    *h;
  509. XX  
  510. XX  {
  511. XX!   return (DIF (h, if_opackets) / DIF (h, curtime.tv_sec));
  512. XX  }
  513. XX  
  514. XX! int foerr (h)
  515. XX  
  516. XX! METER    *h;
  517. XX  
  518. XX  {
  519. XX!   return (DIF (h, if_oerrors) / DIF (h, curtime.tv_sec));
  520. XX  }
  521. XX  
  522. XX! int fcoll (h)
  523. XX  
  524. XX! METER    *h;
  525. XX  
  526. XX  {
  527. XX!   return (DIF (h, if_collisions) / DIF (h, curtime.tv_sec));
  528. XX  }
  529. XX  
  530. XX! int fswt (h)
  531. XX  
  532. XX! METER    *h;
  533. XX  
  534. XX  {
  535. XX!   return (DIF (h, v_swtch) / DIF (h, curtime.tv_sec));
  536. XX  }
  537. XX  
  538. XX! int fload (h)
  539. XX  
  540. XX! METER    *h;
  541. XX  
  542. XX  {
  543. XX    return (h->sh->st[h->sh->idx].avenrun[0]);
  544. XX***************
  545. XX*** 548,554 ****
  546. XX  /*
  547. XX   * getmeter - Executes rstat(3) call to read statistics for specified host.
  548. XX   *   I do all the rpc junk myself so that I have better control over timeouts
  549. XX!  *   and retries than rstat(3) gives me.  If we're watching multiple stats
  550. XX   *   on the same host I only do one rstat(3) call (refcnt and curcnt are
  551. XX   *   used for this).
  552. XX   */
  553. XX--- 531,537 ----
  554. XX  /*
  555. XX   * getmeter - Executes rstat(3) call to read statistics for specified host.
  556. XX   *   I do all the rpc junk myself so that I have better control over timeouts
  557. XX!  *   than rstat(3) gives me.  If we're watching multiple stats
  558. XX   *   on the same host I only do one rstat(3) call (refcnt and curcnt are
  559. XX   *   used for this).
  560. XX   */
  561. XX***************
  562. XX*** 558,565 ****
  563. XX  
  564. XX  {
  565. XX    enum clnt_stat    cs;
  566. XX-   struct statstime    *ost;
  567. XX    register SHMETER    *sh;
  568. XX  
  569. XX    sh = h->sh;
  570. XX    if (sh->curcnt >= sh->refcnt)
  571. XX--- 541,548 ----
  572. XX  
  573. XX  {
  574. XX    enum clnt_stat    cs;
  575. XX    register SHMETER    *sh;
  576. XX+   int            p;
  577. XX  
  578. XX    sh = h->sh;
  579. XX    if (sh->curcnt >= sh->refcnt)
  580. XX***************
  581. XX*** 566,585 ****
  582. XX        sh->curcnt = 0;
  583. XX    if (!sh->curcnt++) {
  584. XX        if (sh->clnt == NULL) {
  585. XX!           if ((sh->addr.sin_port = getport (h)) < 0)
  586. XX            return (-1);
  587. XX            sh->s = RPC_ANYSOCK;
  588. XX!           if (!(sh->clnt = clntudp_create (&sh->addr, RSTATPROG, RSTATVERS,
  589. XX                        ptto, &sh->s)))
  590. XX            return (-1);
  591. XX!       ost = NULL;
  592. XX            sh->idx = 0;
  593. XX        } else {
  594. XX!       ost = &sh->st[sh->idx];
  595. XX        sh->idx ^= 1;
  596. XX        }
  597. XX        cs = clnt_call (sh->clnt, RSTATPROC_STATS, xdr_void, 0, xdr_statstime,
  598. XX!               &sh->st[sh->idx], tto);
  599. XX        if (cs != RPC_SUCCESS) {
  600. XX            clnt_destroy (sh->clnt);
  601. XX            sh->clnt = NULL;
  602. XX--- 549,569 ----
  603. XX        sh->curcnt = 0;
  604. XX    if (!sh->curcnt++) {
  605. XX        if (sh->clnt == NULL) {
  606. XX!           if ((p = getport (h)) < 0)
  607. XX            return (-1);
  608. XX+       sh->addr.sin_port = p;
  609. XX            sh->s = RPC_ANYSOCK;
  610. XX!           if (!(sh->clnt = clntudp_create(&sh->addr, RSTATPROG, RSTATVERS_TIME,
  611. XX                        ptto, &sh->s)))
  612. XX            return (-1);
  613. XX!       sh->first = 1;
  614. XX            sh->idx = 0;
  615. XX        } else {
  616. XX!       sh->first = 0;
  617. XX        sh->idx ^= 1;
  618. XX        }
  619. XX        cs = clnt_call (sh->clnt, RSTATPROC_STATS, xdr_void, 0, xdr_statstime,
  620. XX!               &sh->st[sh->idx], ptto);
  621. XX        if (cs != RPC_SUCCESS) {
  622. XX            clnt_destroy (sh->clnt);
  623. XX            sh->clnt = NULL;
  624. XX***************
  625. XX*** 586,592 ****
  626. XX            return (-1);
  627. XX        }
  628. XX    }
  629. XX!   return (sh->clnt == NULL ? -1 : (sd[h->stat].val) (h, ost));
  630. XX  }
  631. XX  
  632. XX  /*
  633. XX--- 570,577 ----
  634. XX            return (-1);
  635. XX        }
  636. XX    }
  637. XX!   return (sh->first ? 0 :
  638. XX!               sh->clnt == NULL ? -1 : (sd[h->stat].val) (h));
  639. XX  }
  640. XX  
  641. XX  /*
  642. XX***************
  643. XX*** 599,605 ****
  644. XX  {
  645. XX    CLIENT        *c;
  646. XX    enum clnt_stat    cs;
  647. XX!   static struct pmap    pm = {RSTATPROG, RSTATVERS, IPPROTO_UDP, 0};
  648. XX    short         p;
  649. XX    register SHMETER    *sh;
  650. XX  
  651. XX--- 584,590 ----
  652. XX  {
  653. XX    CLIENT        *c;
  654. XX    enum clnt_stat    cs;
  655. XX!   static struct pmap    pm = {RSTATPROG, RSTATVERS_TIME, IPPROTO_UDP, 0};
  656. XX    short         p;
  657. XX    register SHMETER    *sh;
  658. XX  
  659. XX***************
  660. XX*** 608,614 ****
  661. XX    sh->addr.sin_port = htons (PMAPPORT);
  662. XX    if (!(c = clntudp_create (&sh->addr, PMAPPROG, PMAPVERS, ptto, &sh->s)))
  663. XX        return (-1);
  664. XX!   cs = clnt_call (c, PMAPPROC_GETPORT, xdr_pmap, &pm, xdr_u_short, &p, tto);
  665. XX    clnt_destroy (c);
  666. XX    return (cs == RPC_SUCCESS ? p : -1);
  667. XX  }
  668. XX--- 593,599 ----
  669. XX    sh->addr.sin_port = htons (PMAPPORT);
  670. XX    if (!(c = clntudp_create (&sh->addr, PMAPPROG, PMAPVERS, ptto, &sh->s)))
  671. XX        return (-1);
  672. XX!   cs = clnt_call (c, PMAPPROC_GETPORT, xdr_pmap, &pm, xdr_u_short, &p, ptto);
  673. XX    clnt_destroy (c);
  674. XX    return (cs == RPC_SUCCESS ? p : -1);
  675. XX  }
  676. XX*** /tmp/,RCSt1a14050    Thu Jun  7 16:32:55 1990
  677. XX--- xmeter.man    Thu Jun  7 16:13:46 1990
  678. XX***************
  679. XX*** 17,29 ****
  680. XX  .PP
  681. XX  .TP 8
  682. XX  .B \-timeout \fIseconds\fP
  683. XX! This option specifies the timeout between retries for rpc calls to the
  684. XX  remote rstatd(8).  The default is 5 seconds.
  685. XX- .PP
  686. XX- .TP 8
  687. XX- .B \-retries \fIinteger\fP
  688. XX- This option specifies the total number of retries for rpc calls before
  689. XX- assuming a host is down.  The default is 2.
  690. XX  .PP
  691. XX  .TP 8
  692. XX  .B \-orientation \fIorientation\fP
  693. XX--- 17,24 ----
  694. XX  .PP
  695. XX  .TP 8
  696. XX  .B \-timeout \fIseconds\fP
  697. XX! This option specifies the timeout between rpc calls to the
  698. XX  remote rstatd(8).  The default is 5 seconds.
  699. XX  .PP
  700. XX  .TP 8
  701. XX  .B \-orientation \fIorientation\fP
  702. SHAR_EOF
  703. if test 16505 -ne "`wc -c patch2`"
  704. then
  705. echo shar: error transmitting patch2 '(should have been 16505 characters)'
  706. fi
  707. #    End of shell archive
  708. exit 0
  709.  
  710.  
  711. dan
  712. ----------------------------------------------------
  713. O'Reilly && Associates   argv@sun.com / argv@ora.com
  714. Opinions expressed reflect those of the author only.
  715.